package com.csdj.controller.sy;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.csdj.common.utils.ResponseResult;
import com.csdj.dto.EmpPowerDto;
import com.csdj.pojo.SyEmpareapower;
import com.csdj.service.SyEmpareapowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 涵哥
 * @date 2023-08-28 17:29
 */
@RestController
@RequestMapping("/sy/empAreaPower")
public class SystemEmpAreaPowerController {

    @Autowired
    private SyEmpareapowerService syEmpareapowerService;


    /**
     * 根据员工的id返回list
     */
    @GetMapping("/byEmpid/{empId}")
    public ResponseResult byEmpidGetList(@PathVariable Integer empId){
        return ResponseResult.okResult(syEmpareapowerService.list(Wrappers.<SyEmpareapower>lambdaQuery().eq(SyEmpareapower::getEmpID,empId)));
    }
    /**
     *设置片区权限的保存
     * @return
     */
    @PostMapping("/edit")
    public ResponseResult edit(@RequestBody EmpPowerDto empPowerDto){
        return syEmpareapowerService.edit(empPowerDto);
    }
}
